/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package thinkinginjava.svn.typeinformation;

import java.util.Arrays;
import java.util.List;

/**
 *
 * @author public_enemy
 */
abstract class Shape {

    void draw() {
        System.out.println(this + ".draw()");
    }

    @Override
    abstract public String toString();
}

class Triangle extends Shape {

    @Override
    public String toString() {
        return "Triangle";
    }
}

class Circle extends Shape {

    @Override
    public String toString() {
        return "Circle";
    }
}

class Square extends Shape {

    @Override
    public String toString() {
        return "Square";
    }
}

public class Shapes {

    public static void main(String[] args) {
        List<Shape> shapesList = Arrays.asList(new Triangle(), new Circle(), new Square());

        for (Shape shape : shapesList) {
            shape.draw();
        }
    }
}
